Repository navigation
fix(shield): protect component and GKE Autopilot labels - #2799
Merged
Merged
Conversation
matteo-porta
force-pushed
the
matteo/shield-label-precedence
branch
from
November 3, 2026 12:28
5705189 to
1a62392
Compare
matteo-porta
requested review from
aroberts87
and
a balanced review from Copilot
November 3, 2026 12:37
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the label-precedence change.
No open issues 🎉
What changed in this PR
Carries the label-precedence fix from #2748 onto main, protecting Shield’s built-in component and GKE Autopilot labels while preserving component labels’ precedence over global labels.
Changes:
- Merge protected labels before user-supplied component labels for cluster, Linux host, and Windows host resources.
- Add four regression tests covering component identity and GKE Autopilot labels.
- Bump the Shield chart version from
1.55.0to1.55.1.
| File | Description |
|---|---|
charts/shield/tests/host/daemonset-windows_test.yaml |
Tests protection of the Windows host component label. |
charts/shield/tests/host/daemonset_test.yaml |
Tests protection of host component and Autopilot labels. |
charts/shield/tests/cluster/deployment_test.yaml |
Tests protection of the cluster component label. |
charts/shield/templates/host/_windows_labels.tpl |
Gives built-in Windows host labels precedence. |
charts/shield/templates/host/_labels.tpl |
Gives built-in host and Autopilot labels precedence. |
charts/shield/templates/cluster/_labels.tpl |
Gives built-in cluster labels precedence. |
charts/shield/Chart.yaml |
Updates the chart version to 1.55.1. |
Review effort: Balanced
aroberts87
approved these changes
Nov 3, 2026
…nd GKE Autopilot labels Sprig's merge keeps the value from the leftmost source on a key collision. cluster.labels, host.labels and host_windows.labels were merged before the chart's own component labels, so a user value for sysdig/component (or, on GKE Autopilot, the autopilot.gke.io/no-connect and cloud.google.com/matching-allowlist labels) replaced the built-in one. Merge the built-in labels first. Global labels were already merged after them.
matteo-porta
enabled auto-merge (squash)
November 3, 2026 16:41
aroberts87
force-pushed
the
matteo/shield-label-precedence
branch
from
November 3, 2026 16:41
1a62392 to
540ecc9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
Component-level labels can override the built-in
sysdig/componentlabel and GKE Autopilot labels. This can make rendered resources carry the wrong identity or allowlist labels.Merge the built-in labels before user-supplied component labels for cluster, host and Windows host resources. Preserve user component label precedence over global labels.
This carries the fix from #2748 onto
main.Testing
mainand pass with this change.helm unittest --strict -f 'tests/*/*_test.yaml' ./charts/shield: 697 tests passed.make lintandmake -o deps-unittest unittestpassed. The lint command disables version increment checking.Checklist
_testsuffix.